package com.yuteng.commons.exception;




import com.yuteng.commons.exception.enums.abs.AbstractBaseExceptionEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 制定统一的异常处理类
 *
 * @version 1.0
 * @author： 余腾
 * @date： 2021-10-20 13:06
 */
@Data

@EqualsAndHashCode(callSuper = true)
public class YutengException extends RuntimeException {
    private Integer code;
    private String errorMsg;

    public YutengException(Integer code, String errorMsg) {
        super(errorMsg);
        this.code = code;
        this.errorMsg = errorMsg;
    }

    public YutengException(AbstractBaseExceptionEnum abstractBaseExceptionEnum) {
        super(abstractBaseExceptionEnum.getMessage());
        this.code = abstractBaseExceptionEnum.getCode();
        this.errorMsg = abstractBaseExceptionEnum.getMessage();
    }


}
